package ch08_Swing高级组件.JOptionPanel;

import javax.swing.*;

public class JOptionPaneDemo {
    public static void main(String[] args) {
//        JFrame f = new JFrame("JOptionPaneDemo");
//        f.setSize(400,200);
//        f.setLocationRelativeTo(null);
//        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//        f.setLayout(null);
//        String[] btnsText={"好，删除","不，以后再说"};
//        String[] groups = {"同事","家人","同学"};
//        JOptionPane.showMessageDialog(f,"消息发送失败。","发送邮件",JOptionPane.ERROR_MESSAGE);
//        JOptionPane.showMessageDialog(f,"收到一封新邮件。","收到邮件",JOptionPane.INFORMATION_MESSAGE);
//        JOptionPane.showConfirmDialog(f,"确认删除该邮件吗？","删除邮件",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
//        JOptionPane.showOptionDialog(f,"确认删除该邮件吗？","删除邮件",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,btnsText,btnsText[1]);
//        JOptionPane.showInputDialog(f,"请输入收件人地址：","name@gmail.com");
//        JOptionPane.showInputDialog(f,"请选择联系人分类：","选择分类",JOptionPane.PLAIN_MESSAGE,null,groups,groups[1]);
        JFrame f = new JFrame("JOptionnPaneDemo");
        f.setLayout(null);
        f.setSize(400,200);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        String[] btnsText ={"yes","no"};
        String[] groups = {"colleague","family","classmates"};
        JOptionPane.showMessageDialog(f,"邮件发送失败！","发送邮件",JOptionPane.ERROR_MESSAGE);
        JOptionPane.showMessageDialog(f,"收到一封邮件","收到邮件",JOptionPane.INFORMATION_MESSAGE);
        JOptionPane.showConfirmDialog(f,"确认要删除邮件吗？","删除邮件",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
        JOptionPane.showOptionDialog(f,"确认要删除邮件吗？","删除邮件",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,btnsText,btnsText[1]);
        JOptionPane.showInputDialog(f,"请输入收件人地址","name@email.com");
        JOptionPane.showInputDialog(f,"请选择联系人分类：","选择分类",JOptionPane.PLAIN_MESSAGE,null,groups,groups[1]);
        f.setVisible(true);
    }
}
